/*
 * ------------------------------------------
 * 项目模块基类实现文件
 * @version  1.0
 * @author   genify(caijf@corp.netease.com)
 * ------------------------------------------
 */
NEJ.define([
    'base/klass',
    'base/element',
    'util/template/tpl',
    'pro/module/module',
    'util/tab/view'
], function(_k,_e,_l,_m, tab ,_p,_pro){
    /**
     * 项目模块基类对象
     * @class   {wd.m._$$ModuleLayoutSystem}
     * @extends {nej.ut._$$AbstractModuleLayoutSystem}
     * @param   {Object}  可选配置参数，已处理参数列表如下所示
     */
    _p._$$TabNode = _k._$klass();
    _pro = _p._$$TabNode._$extend(_m._$$Module);

    /**
     * 构建模块
     * @return {Void}
     */
    _pro.__doBuild = function(){
        this.__super();
        this.__body = _e._$html2node(
            _l._$getTextTemplate('tab-node')
        );

        this.__tbview = tab._$$TabView._$allocate({
            list: _e._$getChildren('tab-node-parent'),
            oncheck:this.__doCheckMatchEQ._$bind(this),
            selected: 'z-crt'
        })
    };
    /**
     * 刷新模块
     * @param  {Object} 配置信息
     * @return {Void}
     */
    _pro.__onRefresh = function(_options){
        console.log(this.__doParseUMIFromOpt(_options));
        this.__super(_options);
        this.__tbview._$match(
            this.__doParseUMIFromOpt(_options)
        );
    };
    /**
     * 验证选中项
     * @param  {Object} 事件信息
     * @return {Void}
     */
    _pro.__doCheckMatchEQ = function(_event){
        _event.matched = _event.target.indexOf(_event.source)==0;
    };
    // notify dispatcher
    _m._$regist(
        'tab-node',
        _p._$$TabNode
    );
});
